<?php $this->headTitle('Allocation Result');  ?>

<?php if(!empty($this->returnMessageSuccess)): ?>
<div class="success"><?php echo $this->escape($this->returnMessageSuccess[0]); ?></div>
<?php endif; ?>

<?php if(!empty($this->returnMessageWarning)): ?>
<div class="warning"><?php echo $this->escape($this->returnMessageWarning[0]); ?></div>
<?php endif; ?>

<div class="box">
  <div class="left"></div>
  <div class="right"></div>
  <div class="heading">
    <h1 style="background-image: url('images/setting.png');">Allocation Result</h1>
  </div>
  <div class="content">

     <?php if((array_key_exists('successful', $this->message)) && (count($this->message['successful']))): ?>
      <table style="width: 100%" border="0" cellspacing="0" cellpadding="0" class="filter">
	<tr>
            <td><b>Successful Allocation(s)</b></td>
	</tr>
      </table>
      <table class="list">
        <thead>
          <tr>
            <td class="left">Product</td>
            <td class="right">Quantity Allocated</td>
            <td class="right">Branch</td>
          </tr>
        </thead>
        <tbody>
                    <?php foreach($this->message['successful'] as $successful): ?>
                      <tr>
                        <td class="left"><?php echo $successful['product']; ?></td>
                        <td class="right"><?php echo $successful['quantity']; ?></td>
                        <td class="right"><?php echo $successful['branch']; ?></td>
                      </tr>
                    <?php endforeach; ?>
        </tbody>
      </table>
     <?php endif; ?>

      <?php if((array_key_exists('unsuccessful', $this->message)) && (count($this->message['unsuccessful']))): ?>
      <table style="width: 100%" border="0" cellspacing="0" cellpadding="0" class="filter">
	<tr>
            <td><b>Unsuccessful Allocation(s)</b> - This allocations cannot be set because the quantity has exceeded the available unallocated quantity.</td>
	</tr>
      </table>
      <table class="list">
        <thead>
          <tr>
            <td class="left">Product</td>
            <td class="right">Quantity Allocated</td>
            <td class="right">Branch</td>
          </tr>
        </thead>
        <tbody>
                    <?php foreach($this->message['unsuccessful'] as $unsuccessful): ?>
                      <tr>
                        <td class="left"><?php echo $unsuccessful['product']; ?></td>
                        <td class="right"><?php echo $unsuccessful['quantity']; ?></td>
                        <td class="right"><?php echo $unsuccessful['branch']; ?></td>
                      </tr>
                    <?php endforeach; ?>
        </tbody>
      </table>
     <?php endif; ?>
  </div>
</div>